<?php
/**
 * WaterSendMessageMsgtpl
 *
 * @author Administrator
 */
class WaterSendMessageMsgtpl extends BaseMsgtpl
{
	/**
	 * 给用户发送消息
	 * @param array $orderInfo	订单信息
	 */
	public function sendMessageToUser($orderInfo) 
	{
		$wechat = D('Wechat')->get($orderInfo['wechat_id']);
		session('account_id',$wechat['account_id']);
		$fans = D('Fans')->get($orderInfo['fans_id'], 'openid,subscribe,wechat_id');
		$url = 'wap.xt.beescrm.com/'.U('base/water/index',array('wechat_id' => $orderInfo['wechat_id']));
		
		if ($fans['subscribe']) {
			vendor('Weixin.Weixin_api');
			$weixin = new Weixin_api($wechat['wechat_id']);
			$info = array(
				'first' => array("value" => '您的桶装水已经开封一周，请尽快更换，以免影响您的身体健康。', 'color' => '#173177'),
				'keyword1' => array("value" => '温馨提示'),
				'keyword2' => array("value" => date('Y-m-d H:i'), "color" => "#173177"),
				'keynote3' => array("value" => ''),
				'remark' => array("value" => '点此可登录订水模块进行订水哦~'),
			);
			$this->wxObj->messageTpl($wechat['appid'], $wechat['appsecret'], $fans['openid'], $this->wxTplSign, $info, $url);
		}
	}
}
